<template>
    <!-- 排行榜单 -->
    <view class="the-charts">
        <view class="the-charts-title ss-p-x-20">
            <view class="title">
                推荐榜单
            </view>
            <view class="the-more">
                <view class="more">
                    更多
                </view>
                <uni-icons type="right" :color="'#63A9D5'" size="15"></uni-icons>
            </view>
        </view>
        <scroll-view scroll-x="true">
            <view class="the-charts-list ss-p-l-20">
                <view class="item-the-charts" v-for="(item, index) in data" :key="index" @click="tabClick(item.url)">
                    <image :src="sheep.$url.static(item.image)" :class="[index === data.length - 1 && 'ss-m-r-20']"></image>
                </view>
            </view>
        </scroll-view>
    </view>
</template>

<script setup>
import {
    computed,
    reactive,
    ref
} from 'vue';
import {
    onLoad,
} from '@dcloudio/uni-app';
import sheep from '@/sheep';
import $share from '@/sheep/platform/share';

// 隐藏原生tabBar
uni.hideTabBar();

const props = defineProps({
  data: {
    type: Array,
    default: () => ([]),
  }
});
const template = computed(() => sheep.$store('app').template?.home);
const state = reactive({
    chartsInd: 0,
    indicatorDots: false,
    autoplay: true,
    interval: 2000,
    duration: 500
})

onLoad((options) => {
    // #ifdef MP
    // 小程序识别二维码
    if (options.scene) {
        const sceneParams = decodeURIComponent(options.scene).split('=');
        options[sceneParams[0]] = sceneParams[1];
    }
    // #endif
    // 预览模板
    if (options.templateId) {
        sheep.$store('app').init(options.templateId);
    }

    // 解析分享信息
    if (options.spm) {
        $share.decryptSpm(options.spm);
    }

    // 进入指定页面(完整页面路径)
    if (options.page) {
        sheep.$router.go(decodeURIComponent(options.page));
    }
});

//tab跳转
function tabClick(url) {
  sheep.$router.go(url);
}
</script>

<style lang="scss" scoped>
	view {
		box-sizing: border-box;
	}
.the-charts {
    width: 100%;
    margin-top: 20rpx;

    .the-charts-title {
        display: flex;
        align-items: center;
        justify-content: space-between;


        .title {
           font-family: Source Han Sans;
           font-size: 36rpx;
           font-weight: bold;
           color: #3D3D3D;

        }

        .the-more {
            display: flex;
            align-items: center;
            font-size: 24rpx;
            color: #63A9D5;
        }
    }

    .the-charts-list {
        width: 100%;
        display: flex;

        .item-the-charts {
            margin-right: 24rpx;
            margin-top: 30rpx;

            image {
                width: 180rpx;
                height: 180rpx;
                border-radius: 10rpx;
            }
        }
    }

    .the-charts-type {
        width: 100%;
        display: flex;
        align-items: center;
        margin-top: 34rpx;

        .item-type {
            width: calc(20% - 2rpx);
            text-align: center;

            .item-name {
                font-size: 32rpx;
                color: #333333;

            }

            .item-val {
                font-size: 20rpx;
                color: #898989;
                margin-top: 4rpx;
                padding: 6rpx;
            }

            .item-val-active {
                color: #fff;
                padding: 6rpx;
                border-radius: 200rpx;
                background-color: #E96458;
            }


        }

        .item-type-xian {
            width: 2rpx;
            height: 74rpx;
            background-color: #EEEEEE;
            margin: 0 14rpx;
        }
    }
}


</style>